<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Basic Form </title>

    <!-- ================= Favicon ================== -->

    <!-- Styles -->
    <link href="__VIS__/css/lib/font-awesome.min.css" rel="stylesheet">
    <link href="__VIS__/css/lib/themify-icons.css" rel="stylesheet">
    <link href="__VIS__/css/lib/menubar/sidebar.css" rel="stylesheet">
    <link href="__VIS__/css/lib/bootstrap.min.css" rel="stylesheet">
    <link href="__VIS__/css/lib/unix.css" rel="stylesheet">
    <link href="__VIS__/css/style.css" rel="stylesheet">
</head>

<body>
<div class="container-fluid">
    <div class="row">
        <div class="col-lg-8 p-r-0 title-margin-right">
            <div class="page-header">
                <div class="page-title">
                    <h1>短信设置</h1>
                </div>
            </div>
        </div>
        <!-- /# column -->
        <div class="col-lg-4 p-l-0 title-margin-left">
            <div class="page-header">
                <div class="page-title">
                    <ol class="breadcrumb text-right">
                        <li><a href="#">系统设置</a></li>
                        <li class="active">短信设置</li>
                    </ol>
                </div>
            </div>
        </div>
        <!-- /# column -->
    </div>
    <!-- /# row -->
    <section id="main-content">
        <div class="row">
            <div class="col-lg-12">
                <div class="card alert">
                    <div class="card-header">
                        <h4>短信设置</h4>
                        <div class="card-header-right-icon">
                            <ul>
                                <li class="card-close" data-dismiss="alert"><i class="ti-close"></i></li>
                                <li class="doc-link"><a href="#"><i class="ti-link"></i></a></li>
                                <li class="page-refresh"><i class="fa fa-refresh"></i> 刷新页面</li>
                            </ul>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="basic-elements">
                            <form class="vis_form">
                                <div class="row">
                                    <div class="col-lg-6">
                                        <div class="form-group">
                                            <label>AppKey</label>
                                            <input type="text" name="appkey" class="form-control" placeholder="请输入" value="{$data.appkey}">
                                            <span class="help-block">
														<small>阿里大鱼短信接口的AppKey,<a href="https://dayu.aliyun.com/" target="_blank">点击申请</a></small>
													</span>
                                        </div>
                                        <div class="form-group">
                                            <label>SecretKey</label>
                                            <input type="password" name="secretkey" class="form-control" placeholder="请输入" value="{$data.secretkey}">
                                            <span class="help-block">
														<small>阿里大鱼短信接口的SecretKey,<a href="https://dayu.aliyun.com/" target="_blank">点击申请</a></small>
													</span>
                                        </div>
                                        <div class="form-group">
                                            <label>短信类型</label>
                                            <input type="text" name="type" class="form-control" placeholder="请输入" value="{$data.type}">
                                            <span class="help-block">
														<small>文字短信默认为：normal</small>
													</span>
                                        </div>
                                        <div class="form-group">
                                            <label>签名</label>
                                            <input type="text" name="name" class="form-control" placeholder="请输入" value="{$data.name}">
                                            <span class="help-block">
														<small>必须是在阿里大于“管理中心-验证码/短信通知/推广短信-配置短信签名”中的可用签名</small>
													</span>
                                        </div>
                                        <div class="form-group">
                                            <label>短信模板ID</label>
                                            <input type="text" name="code" class="form-control" placeholder="请输入" value="{$data.code}">
                                            <span class="help-block">
														<small>短信模板ID，传入的模板必须是在阿里大于“管理中心-短信模板管理”中的可用模板</small>
													</span>
                                        </div>

                                        <div class="form-group">
                                            <label>附加内容</label>
                                            <textarea class="form-control" rows="4" placeholder="Text input" name="content">{$data.content}</textarea>
                                        </div>

                                        <div class="form-group">
                                            <a href="#" class="btn btn-default btn-outline vis_form_btn">立即提交</a>
                                            <button type="reset" class="btn btn-primary">重置</button>
                                            <a href="#" class="btn btn-normal vis_mail_btn">发送测试</a>
                                        </div>
                                    </div>

                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <!-- /# column -->
            <!-- /# column -->
        </div>
        <!-- /# row -->



    </section>
</div>





<div id="search">
    <button type="button" class="close">×</button>
    <form>
        <input type="search" value="" placeholder="type keyword(s) here" />
        <button type="submit" class="btn btn-primary">Search</button>
    </form>
</div>
<!-- jquery vendor -->
<script src="__VIS__/js/lib/jquery.min.js"></script>
<script src="__VIS__/js/lib/jquery.nanoscroller.min.js"></script>
<!-- nano scroller -->
<script src="__VIS__/js/lib/menubar/sidebar.js"></script>
<script src="__VIS__/js/lib/preloader/pace.min.js"></script>
<!-- sidebar -->
<script src="__VIS__/js/lib/bootstrap.min.js"></script>
<!-- bootstrap -->
<script src="__VIS__/js/layer/layer.js"></script>
<!-- scripit init-->
<script>
    $('.page-refresh').on("click", function() {
        location.reload();
    });
    $('.vis_form_btn').click(function () {
        $.ajax({
            url:"{:url('admin/sms/edit')}",
            type:'POST',
            dataType:'JSON',
            data:$('.vis_form').serialize(),
            success:function (res) {
                if(res.code == 1){
                    layer.msg(res.msg,{icon:6},function () {
                        window.location.href=res.url;
                    })
                }else {
                    layer.msg(res.msg,{icon:5})
                }
            }
        })
    });
    $('.vis_mail_btn').click(function () {
        layer.prompt({
            formType: 0,
            value: '',
            title: '请输入手机号码,不要重复点确定键'
        }, function(value, index, elem){
            phone = value;
            // if(email = null) {
            //   layer.msg('收件箱不能为空');
            //   return false;
            // }
            $.ajax({
                url:"{:url('admin/sms/sendto')}"
                ,type:'post'
                ,data:{phone:phone}
                ,success:function(res) {
                    layer.msg(res.msg);
                    if(res.code == 1) {
                        layer.close(index);
                    }
                }
            })
        });
        return false;
    })
</script>




</body>

</html>